#include "tcpServer.hpp"
#include "daemon.hpp"
#include <memory>

void Usage(std::string proc)
{
    std::cout << "\nUsage:\n\t" << proc << " local_port\n\n";
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);

    std::unique_ptr<TcpServer> tsvr(new TcpServer(port));
    tsvr->initServer();
    //将进程守护进程化
    //daemonSelf();
    tsvr->start();

    return 0;
}